<!DOCTYPE HTML>
<html ng-app="OutlerCenterApp">
<head>
    <title>微商</title>
    <meta charset="utf-8">
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
    <meta content="zh-CN" http-equiv="content-language"/>
    
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    
    <!--  android 版本 清除微信浏览器缓存：请关闭微信程序重新打开即可。 -->
    <meta content="telephone=no, address=no" name="format-detection">
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"/>
    <!----------- CSS ----------->
    <link href="resources/css/style.css" rel="stylesheet">
    
    <link href="resources/css/ionic.app.min.css" rel="stylesheet">
    
    <link href="resources/lib/ngDialog/ngDialog.min.css" rel="stylesheet"/>
    <link href="resources/lib/ngDialog/ngDialog-theme-default.min.css" rel="stylesheet"/>
    
    <link href="resources/lib/tabSlideBox/tabSlideBox.min.css" rel="stylesheet"/>
    
    
    <!----------- JavaScript ----------->
    <script type="text/javascript" src="resources/lib/jquery/jquery.min.js"></script>
	
	<script type="text/javascript" src="resources/lib/ionic/js/angular/angular.min.js"></script>
	<script type="text/javascript" src="resources/lib/ionic/js/angular/angular-animate.min.js"></script>
	<script type="text/javascript" src="resources/lib/ionic/js/angular-ui/angular-ui-router.min.js"></script>
	
	<!-- Ionic JS -->    
    <script type="text/javascript" src="resources/lib/ionic/js/ionic.min.js"></script>
    <script type="text/javascript" src="resources/lib/ionic/js/ionic-angular.min.js"></script>
    <script type="text/javascript" src="resources/lib/ionic/js/ionic.bundle.min.js"></script>
	
	<!-- plugins -->
    <script type="text/javascript" src="resources/lib/ngDialog/ngDialog.min.js"></script>
	<script type="text/javascript" src="resources/lib/tabSlideBox/tabSlideBox.min.js"></script>
    
    <!-- My JS code For Production-->    
    <script type="text/javascript" src="resources/js/app.js"></script>
    <script type="text/javascript" src="resources/js/directives.js"></script>
    <script type="text/javascript" src="resources/js/filters.js"></script>
    <script type="text/javascript" src="resources/js/services.js"></script>

	<!-- Controllers -->    
    <script type="text/javascript" src="resources/js/controllers/AddressController.js"></script>
    <script type="text/javascript" src="resources/js/controllers/StoreController.js"></script>
    <script type="text/javascript" src="resources/js/controllers/StoreGoodsDetailController.js"></script>
    
    <script type="text/javascript" src="resources/js/controllers/OrderConfirmController.js"></script>
    
    <script type="text/javascript" src="resources/js/controllers/CartController.js"></script>
    <script type="text/javascript" src="resources/js/controllers/CartGoodsDetailController.js"></script>
    
    <script type="text/javascript" src="resources/js/controllers/OrdersController.js"></script>
    
    <script type="text/javascript" src="resources/js/controllers/MyCenterController.js"></script>
    <script type="text/javascript" src="resources/js/controllers/MyAddressController.js"></script>
    <script type="text/javascript" src="resources/js/controllers/AddressPickerController.js"></script>
    
    <!-- 对接微信 JS Api -->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">

	console.log(location.href.split('#')[0]);
	var thisPageUrl = location.href.split('#')[0];
	//alert(thisPageUrl);
	
	$.ajax({ url: "jsapi/ajax/sign",
		 type: "POST",
		 data:{url:""+thisPageUrl},
		 dataType: "json",
		 //sync: true,
		 cache: false,//解决三星手机，缓存后不提交请求
		 success: function(data){
			 console.log(data);
			 //alert(data);
			 if(data.success){
				configWeiXin(data.appId,data.timestamp,data.nonceStr,data.signature);
				//regiestWxJsApi();
			}else{
				console.log("配置weixin jsapi失败");
			}
			
		 },
	  	 error: function(XMLHttpRequest, textStatus, errorThrown){
	      	console.log(XMLHttpRequest.responseText);
		 }
	});




  /*
   * 注意：
   * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
   * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
   * 3. 常见问题及完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
   *
   * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决，如仍未能解决可通过以下渠道反馈：
   * 邮箱地址：weixin-open@qq.com
   * 邮件主题：【微信JS-SDK反馈】具体问题
   * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
   */
function configWeiXin(appId, timestamp, nonceStr, signature){
	   wx.config({
	      debug: false,// 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
	      appId: appId,
	      timestamp: timestamp,
	      nonceStr: nonceStr,
	      signature: signature,
	      jsApiList: [
	        'checkJsApi',
	        'onMenuShareTimeline',
	        'onMenuShareAppMessage',
	        'onMenuShareQQ',
	        'onMenuShareWeibo',
	        'hideMenuItems',
	        'showMenuItems',
	        'hideAllNonBaseMenuItem',
	        'showAllNonBaseMenuItem',
	        'translateVoice',
	        'startRecord',
	        'stopRecord',
	        'onRecordEnd',
	        'playVoice',
	        'pauseVoice',
	        'stopVoice',
	        'uploadVoice',
	        'downloadVoice',
	        'chooseImage',
	        'previewImage',
	        'uploadImage',
	        'downloadImage',
	        'getNetworkType',
	        'openLocation',
	        'getLocation',
	        'hideOptionMenu',
	        'showOptionMenu',
	        'closeWindow',
	        'scanQRCode',
	        'chooseWXPay',
	        'openProductSpecificView',
	        'addCard',
	        'chooseCard',
	        'openCard'
	      ]
	  });
   }
   

	//
	function regiestWxJsApi(){
	}
   
	// config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口
	//，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
	wx.ready(function(){
		//wx.hideOptionMenu();
	});
	
	wx.error(function(res){
		alert("config信息验证失败");
	    // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。

	});
	
	wx.checkJsApi({
	    jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
	    success: function(res) {
	        // 以键值对的形式返回，可用的api值true，不可用为false
	        // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
	        // alert(res);
	    },
	    error:function(res){
	    	//alert(res);
	    }
	});
	
</script>
    
</head>

<body>
	<ion-nav-bar class="bar-balanced">
	    <ion-nav-back-button></ion-nav-back-button>
  	</ion-nav-bar>

  	<ion-nav-view></ion-nav-view>
  	
 
</body>
</html>